package com.shuiyun.log.service;

import com.shuiyun.log.anno.LogAnno;
import com.shuiyun.log.dao.LogDAO;
import com.shuiyun.log.enums.LogType;
import com.shuiyun.log.po.LogPO;
import com.shuiyun.log.vo.UserVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @program: LogDemo
 * @description: 测试service
 * @author: gujun
 * @create: 2019-10-11 10:19
 **/
@Service
public class DemoService {
    @Autowired
    private UserService userService;
    private LogDAO logDAO;

    @Transactional
    @LogAnno(dataType = "user",logType = LogType.INSERT)
    public String test(){
        UserVO userVO = new UserVO();
        userVO.setId(658L);
        userVO.setUserNo("4444");
        userVO.setUserGender(2001);
        userVO.setUserAge(85);
        // mapper caozuo
        logDAO.save(new LogPO());
//        userService.editUser(userVO);//service  成功  理论上发送数据
        int i = 1/0; // service2 失败
        return "ok";
    }
}
